package com.kotlin.flong.reflection

import kotlin.reflect.full.memberProperties

/**
 * @Author:liangjl
 * @Date: 2020/7/12-8:20
 * @Eamil:jilongliang@sina.com
 * @Description:
 */

class MyTest8 {
    var name: String = "周伯通"
}

fun main() {
    var myTestClass8 = MyTest8::class
    var myTest8Obj = MyTest8()

    var variableIvnke = myTestClass8.memberProperties.find { it.name == "name" }
    //通过属性去获取值
    println(variableIvnke?.get(myTest8Obj))
    //通过反射去获取值
    println(variableIvnke?.call(myTest8Obj))

}